	
	u "data/panel_mafiaconsmig", clear
	
		drop if iddecade==1|iddecade==4 // 1951 | 1981

**-----------------------------------------------------

			* Appendix E
			*Instrument for migration

**-----------------------------------------------------

*Figure E.1: Drought Severity Index and number of migrants, 1961-1971

tw (scatter migshare zssmig_rob)(lfit migshare zssmig_rob, lcolor(blue)), legend(off) ytitle(Share southern migrants) xtitle(Instrument for migration using Drought) name(iv_nonparametric_mig_rob, replace) 

xtreg migshare zssc zssmig_rob zss dec2 dec3 ipop, fe cluster(municipalities)
	predict zmigshare_xb_rob
	tw (scatter migshare zmigshare_xb_rob, mcolor(%30)) ///
		(lfit migshare zmigshare_xb_rob, lcolor(blue)), ytitle("Actual Migration", size(small)) ///
			xtitle("Predicted Migration from Drought" "controlling for other instruments and fixed effects", size(small)) legend(off) name(iv_fs_mig_rob, replace)
			
graph combine iv_nonparametric_mig_rob iv_fs_mig_rob
graph export "figures/figureE1.pdf", as(pdf) replace
	
	

*Table E.1: First Stage, Drought as push factor for migration

	 xtivreg2 newspc (zempcp zmigshare zem = zssc zssmig_rob zss_rob) ipop dec2-dec3, fe first savefirst cluster(municipalities) 
		mat t=e(first)
		local fs1=round(t[4,1], 0.01)
		local fs2=round(t[4,2], 0.01)
		local fs3=round(t[4,3], 0.01)
		local f1=round(t[8,1], 0.01)
		local f2=round(t[8,2], 0.01)
		local f3=round(t[8,3], 0.01)
		local ar=round(e(archi2), 0.1)
	
	est restore _xtivreg2_zempcp
		outreg2 using "tables/tableE1", replace tex label dec(3)  keep(zssc zssmig_rob zss_rob) addtext(City Decade FE, Yes) adds(SW F-Stat, `f1', A-R Wald test, `ar') nocons nor2
	est restore _xtivreg2_zmigshare
		outreg2 using "tables/tableE1", tex label dec(3) keep(zssc zssmig_rob zss_rob) addtext(City Decade FE, Yes) adds( SW F-Stat, `f2', A-R Wald test, `ar') nocons nor2
	est restore _xtivreg2_zem
		outreg2 using "tables/tableE1", tex label dec(3) keep(zssc zssmig_rob zss_rob) addtext(City Decade FE, Yes) adds(SW F-Stat, `f3', A-R Wald test, `ar') nocons nor2
		

*Table E.2: Standard and shock-level shift-share estimates
preserve		
		
		* ssaggregate v1: sum-of-share controls, no time FE (sum of share controls)
		u "data/ssaggregate_migration", clear
		merge 1:1 province decade using "data/ssaggregate_sum_shares", keep(3) nogen
		merge 1:1 province decade using "data/ssaggregate_z", keep(3) nogen
		ivreg2 newspc (migshare=z) sum_shares
		outreg2 using "tables/tableE2.tex", replace tex addtext(Decade FE, No, City FE, No, Sum of shares x Decade, Yes) keep(migshare) nor2 nocons
		ssaggregate newspc migshare, l(province) t(decade) sfile("data/ssaggregate_shares_shock_nm") s(share_odt0) n(province_origin) controls("sum_shares")
		merge 1:1 province_origin decade using "data/ssaggregate_shocks", nogen
		ivreg2 newspc (migshare=drought_max01) [aw=s_n] /* match! */
		outreg2 using "tables/tableE2.tex", tex addtext(Decade FE, No, City FE, No, Sum of shares x Decade, Yes) keep(migshare) nor2 nocons
		
		* ssaggregate v2: sum-of-share controls, time FE (sum of share interacted controls)
		u "data/ssaggregate_migration", clear
		merge 1:1 province decade using "data/ssaggregate_sum_shares", keep(3) nogen
		merge 1:1 province decade using "data/ssaggregate_z", keep(3) nogen
		ivreg2 newspc (migshare=z) i.decade c.sum_shares#decade
		outreg2 using "tables/tableE2.tex", tex addtext(Decade FE, Yes, City FE, No, Sum of shares x Decade, Yes) keep(migshare) nor2 nocons
		ssaggregate newspc migshare, l(province) t(decade) sfile("data/ssaggregate_shares_shock_nm") s(share_odt0) n(province_origin) controls("i.decade c.sum_shares#decade")
		merge 1:1 province_origin decade using "data/ssaggregate_shocks", nogen
		ivreg2 newspc (migshare=drought_max01) i.decade [aw=s_n] /* match! */
		outreg2 using "tables/tableE2.tex", tex addtext(Decade FE, Yes, City FE, No, Sum of shares x Decade, No) keep(migshare) nor2 nocons
		
		*ssagregate v3: with time and province FE
		u "data/ssaggregate_migration", clear
		merge 1:1 province decade using "data/ssaggregate_sum_shares", keep(3) nogen
		merge 1:1 province decade using "data/ssaggregate_z", keep(3) nogen
		xtset province decade
		xtivreg newspc (migshare=z) i.decade c.sum_shares#decade, fe
		outreg2 using "tables/tableE2.tex", tex addtext(Decade FE, Yes, City FE, Yes, Sum of shares x Decade, Yes) keep(migshare) nor2 nocons
		ssaggregate newspc migshare, l(province) t(decade) sfile("data/ssaggregate_shares_shock_nm") s(share_odt0) n(province_origin) controls("i.decade c.sum_shares#decade")
		merge 1:1 province_origin decade using "data/ssaggregate_shocks", nogen
		tab decade,gen(dec)
		xtset province_origin decade
		xtivreg2 newspc (migshare=drought_max01) dec2 dec3 [aw=s_n], fe /* match! */
		outreg2 using "tables/tableE2.tex", tex addtext(Decade FE, Yes, City FE, Yes, Sum of shares x Decade, No) keep(migshare) nor2 nocons
restore


*Table E.4: First Stage: impact of each instrument on corresponding regressor

	 xtivreg2 newspc (zempcp zmigshare zem = zssc zssmig zss) ipop dec2-dec3, fe first savefirst cluster(municipalities) 
		mat t=e(first)
		local fs1=round(t[4,1], 0.01)
		local fs2=round(t[4,2], 0.01)
		local fs3=round(t[4,3], 0.01)
		local f1=round(t[8,1], 0.01)
		local f2=round(t[8,2], 0.01)
		local f3=round(t[8,3], 0.01)
		local ar=round(e(archi2), 0.1)
	
	est restore _xtivreg2_zempcp
		outreg2 using "tables/tableE3", replace tex label dec(3)  keep(zssc zssmig zss) addtext(City Decade FE, Yes) adds(SW F-Stat, `f1', A-R Wald test, `ar') nocons nor2
	est restore _xtivreg2_zmigshare
		outreg2 using "tables/tableE3", tex label dec(3) keep(zssc zssmig zss) addtext(City Decade FE, Yes) adds( SW F-Stat, `f2', A-R Wald test, `ar') nocons nor2
	est restore _xtivreg2_zem
		outreg2 using "tables/tableE3", tex label dec(3) keep(zssc zssmig zss) addtext(City Decade FE, Yes) adds(SW F-Stat, `f3', A-R Wald test, `ar') nocons nor2

		
*Figure E.2: First Stage: Actual and predicted values
	xtreg empcp ssc ssmig ss dec2 dec3 ipop, fe cluster(municipalities)
	predict zempcp_xb
	tw (scatter empcp zempcp_xb, mcolor(%30)) ///
		(lfit empcp zempcp_xb, lcolor(blue)), ytitle("Actual Employment", size(small)) ///
		xtitle("Predicted Employment", size(small)) legend(off) name(iv_fs_c, replace)
	
	xtreg migshare zssc zssmig zss dec2 dec3 ipop, fe cluster(municipalities)
	predict zmigshare_xb
	tw (scatter migshare zmigshare_xb, mcolor(%30)) ///
		(lfit migshare zmigshare_xb, lcolor(blue)), ytitle("Actual Migration", size(small)) ///
			xtitle("Predicted Migration", size(small)) legend(off) name(iv_fs_m, replace)
	
	xtreg em zssc zssmig zss dec2 dec3 ipop, fe cluster(municipalities)
	predict zem_xb
	tw (scatter em zem_xb, mcolor(%30)) ///
		(lfit em zem_xb, lcolor(blue)), ytitle("Actual Constr x Migr", size(small)) ///
			xtitle("Predicted Constr x Migr", size(small)) legend(off) name(iv_fs_cm, replace)
		
	graph combine iv_fs_c iv_fs_m iv_fs_cm, cols(3)
	graph export "figures/figureE2.pdf", as(pdf) replace
